function getInterNode (headA, headB) {
  const cacheA = new Set()
  while (headA !== null) {
    cacheA.add(headA)
    headA = headA.next
  }
  while (headB !== null) {
    if (cacheA.contains(headB)) return headB
    headB = headB.next
  }
  return null
}